
public class CubbyHole {
	private int seg;
	private boolean available = false;
	public synchronized int get() {
		while(available==false) {
			try {
				wait();
			}catch(InterruptedException e) {
				
			}
			
		}
		available=false;
		notify();
		return seg;
	}
	public synchronized void put(int value) {
		while(available==true) {
			try {
				wait();
			}catch(InterruptedException e) {
				
			}
			
			
		}
		seg=value;
		available=true;
		notify();
	}
}
